package net.wangds.dymodel.meta.entity;

import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.SuperBuilder;
import net.wangds.data.TableCateEnum;
import net.wangds.data.TableTypeEnum;
import net.wangds.data.ann.ColumnDef;
import net.wangds.data.ann.TableDef;
import net.wangds.data.impl.IdCreateDisable;

import javax.persistence.*;

/**
 * .
 * <p></p>
 *
 * @author 王东石 2021/2/15 19:59.
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@Entity
@TableDef(
        beanClass = "net.wangds.dymodel.meta.entity.DyModelPropDefEntity",
        displayName = "问题专家库",
        tableType = TableTypeEnum.RowOriented,
        category = TableCateEnum.Master
)
@Table(name="dy_model_field_def")
@EqualsAndHashCode(callSuper = true)
public class DyModelPropDefEntity extends IdCreateDisable {

    @ColumnDef(displayname = "动态模型Id")
    @ApiModelProperty("动态模型Id")
    @Column(length=36)
    private String dyModelId;

    @ColumnDef(displayname = "英文名称")
    @ApiModelProperty("英文名称")
    @Column(length=200)
    private String nameEn;

    @ColumnDef(displayname = "中文名称")
    @ApiModelProperty("中文名称")
    @Column(length=200)
    private String nameCn;

    @ColumnDef(displayname = "数据库列名称")
    @ApiModelProperty("数据库列名称")
    @Column(length=200)
    private String columnName;

    @ColumnDef(displayname = "uuid编码")
    @ApiModelProperty("uuid编码")
    @Column(length=36)
    private String code;

    @ColumnDef(displayname = "uuid编码的无‘-’格式")
    @ApiModelProperty("uuid编码的无‘-’格式")
    @Column(length=36)
    private String compactCode;

    @ColumnDef(displayname = "说明")
    @ApiModelProperty("说明")
    @Column(columnDefinition = "TEXT")
    private String remark;

    @ColumnDef(displayname = "是否非空")
    @ApiModelProperty("是否非空")
    @Column(length=1)
    @Builder.Default
    private int nullable=1;

    @ColumnDef(displayname = "字段类型（java)")
    @ApiModelProperty("字段类型（java)")
    @Column(length=50)
    @Enumerated(EnumType.STRING)
    private DyModelFieldTypeEnum fieldType;

    @ColumnDef(displayname = "列类型")
    @ApiModelProperty("列类型")
    @Column(length=50)
    @Enumerated(EnumType.STRING)
    private DyModelColumnTypeEnum columnType;

    @ColumnDef(displayname = "字段业务类型")
    @ApiModelProperty("字段业务类型")
    @Column(length=50)
    @Enumerated(EnumType.STRING)
    private DyModelFieldBizTypeEnum fieldBizType;

    @ColumnDef(displayname = "业务信息")
    @ApiModelProperty("业务信息")
    @Column(columnDefinition = "TEXT")
    private String bizInfo;

    @ColumnDef(displayname = "长度")
    @ApiModelProperty("长度")
    @Column(length=20)
    private int length;

    @ColumnDef(displayname = "精度")
    @ApiModelProperty("精度")
    @Column(length=20)
    private int scale;

    @ColumnDef(displayname = "验证正则表达式")
    @ApiModelProperty("验证正则表达式")
    @Column(length=200)
    private String validateReg;

    @ColumnDef(displayname = "验证失败时的提示")
    @ApiModelProperty("验证失败时的提示")
    @Column(length=100)
    private String invalidatePrompt;

    @ColumnDef(displayname = "可见性")
    @ApiModelProperty("可见性")
    @Column(length=4)
    private int visiable;

    @ColumnDef(displayname = "唯一性")
    @ApiModelProperty("唯一性")
    @Column(length=4)
    private int uni;

    @ColumnDef(displayname = "排序")
    @ApiModelProperty("排序")
    @Column(length=4)
    private int seq;

    @ColumnDef(displayname = "sql语句中别名")
    @ApiModelProperty("sql语句中别名")
    @Column(length=50)
    private String aliasBase;

    @ColumnDef(displayname = "是否全文搜索")
    @ApiModelProperty("是否全文搜索")
    @Column(length=4)
    private int fullTextSearch;

    @ColumnDef(displayname = "是否查询条件")
    @ApiModelProperty("是否查询条件")
    @Column(length=4)
    private int condi;

    @ColumnDef(displayname = "分组序号")
    @ApiModelProperty(value = "分组序号",notes = "分组填写")
    @Column(name="grp", columnDefinition = "int(4) default 0", length=4)
    private int group;

    @ColumnDef(displayname = "分组名称")
    @ApiModelProperty(value = "分组名称",notes = "分组填写")
    @Column(length=100)
    private String groupName;

    @ColumnDef(displayname = "扩展信息")
    @ApiModelProperty(value = "扩展信息",notes = "附加的扩展信息")
    @Column(columnDefinition = "text")
    private String extInfo;

}
